package cn.itcast.methodReference;

import cn.itcast.Test;
import cn.itcast.inteface.MessageInterface;

public class Test01 {
    public static void main(String[] args) {
        //原生的匿名内部类调用方式
        MessageInterface messageInterface = new MessageInterface() {
            @Override
            public void get(Integer a) {
                System.out.println("get："+a);

            }
        };
        messageInterface.get(1);
        System.out.println("-------------------------------------------------");
        //在lambda表达式方法中直接引入方法
        MessageInterface messageInterface1 = (a)-> System.out.println("get:"+a);
        messageInterface1.get(1);

        System.out.println("-------------------------------------------------");

        //在lamdba表达式中直接引入方法体
        MessageInterface messageInterface2 = (a) -> staticGet(a);
        messageInterface2.get(2);

        MessageInterface messageInterface3 = Test01::staticGet;
        messageInterface3.get(4);

    }
    public static  void staticGet(Integer a){
        System.out.println("staticGet："+a);
    }
}
